/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bean;

import java.sql.Date;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 *
 * @author A7med Kotb
 */
public class EditProviderTaskBean extends org.apache.struts.action.ActionForm {
    private String schedule = "";
    private String modifier = "";
    private String startDate = "";
    private String startTime = "";
    private String day;
    private Date startDated;
    private String month;
    private boolean isenable;
    private boolean isrunning;
    private String[] newDays;
    private String[] newMonths;
    private String id;
    
    public EditProviderTaskBean() {
        super();
        // TODO Auto-generated constructor stub
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
    public String[] getNewDays() {
        return newDays;
    }

    public void setNewDays(String[] newDays) {
        this.newDays = newDays;
    }

    public String[] getNewMonths() {
        return newMonths;
    }

    public void setNewMonths(String[] newMonths) {
        this.newMonths = newMonths;
    }
    public boolean getIsenable() {
        return isenable;
    }

    public void setIsenable(boolean isenable) {
        this.isenable = isenable;
    }

    public boolean getIsrunning() {
        return isrunning;
    }

    public void setIsrunning(boolean isrunning) {
        this.isrunning = isrunning;
    }
    
    public String getMonth() {
        return month;
    }

    public void setMonth(String month) {
        this.month = month;
    }

     public Date getStartDated() {
        Date date = null;
        try {
            String str_date = this.getStartDate();
            DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
            java.util.Date d = (java.util.Date) formatter.parse(str_date);
            SimpleDateFormat DBFormat = new SimpleDateFormat("yyyy-MM-dd");
            String DBDate = DBFormat.format(d);
            java.util.Date DBD = (java.util.Date) DBFormat.parse(DBDate);
            date = new Date(DBD.getTime());
            System.out.println("Date is " + date);
        } catch (ParseException ex) {
            ex.printStackTrace();
        }
        return date;
    }

    public void setStartDated(Date startDated) {
        this.startDated = startDated;
    }
    
    public String getDay() {
        return day;
    }

    public void setDay(String day) {
        this.day = day;
    }

    public String getModifier() {
        return modifier;
    }

    public void setModifier(String modifier) {
        this.modifier = modifier;
    }

    public String getSchedule() {
        return schedule;
    }

    public void setSchedule(String schedule) {
        this.schedule = schedule;
    }

    public String getStartDate() {
        return startDate;
    }

    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }
    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param request The HTTP Request we are processing.
     * @return
     */
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();


        return errors;
    }
}
